package com.api.volunteer.service.impl;

import com.api.volunteer.model.SecretKey;
import com.api.volunteer.repository.SecretKeyRepository;
import com.api.volunteer.service.SecretKeyService;
import com.api.volunteer.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.swing.text.html.Option;
import java.util.Optional;

/**
 * @author 邹宇杰
 * @email 2901570623@qq.com
 * @date 2022/4/2 21:32
 */
@Service("secretKeyService")
public class SecretKeyServiceImpl implements SecretKeyService {

    @Autowired
    SecretKeyRepository secretKeyRepository;

    @Override
    public Boolean findSecret(String secret) {
        Optional.ofNullable(secretKeyRepository.findSecretKeyBySecret(secret)).orElseThrow(()->{
            return new RuntimeException("密钥不正确");
        });
        return true;
    }
}
